package cn.tp.ksoft.civil_driver.module.mime;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import cn.tp.ksoft.civil_driver.DriverBaseActivity;
import cn.tp.ksoft.civil_driver.R;
import cn.tp.ksoft.civil_driver.bean.ResultBean;
import cn.tp.ksoft.civil_driver.module.order.OrdersActivity;
import cn.tp.ksoft.civil_driver.request.DriverRequest;
import cn.tp.ksoft.civil_driver.request.RequestModules;

/**
 * Created by zhusong on 16/5/2.
 */
public class MimeActivity extends DriverBaseActivity implements View.OnClickListener{

    private ImageView mIconIv;
    private TextView mNameTv;
    private RatingBar mRatingBar;
    private TextView mEvaluateCountTv;
    private TextView mScoreTv;
    private TextView mLevelTv;
    private TextView mLevelDetailTv;

    private DriverRequest request;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.driver_activity_mine);
        updateTitle(getString(R.string.driver_my));
        mIconIv = (ImageView) findViewById(R.id.iv_icon);
        mNameTv = (TextView) findViewById(R.id.tv_name);
        mRatingBar = (RatingBar) findViewById(R.id.rating);
        mEvaluateCountTv = (TextView) findViewById(R.id.tv_evaluate_count);
        mScoreTv = (TextView) findViewById(R.id.tv_score);
        mLevelTv = (TextView) findViewById(R.id.tv_level);
        mLevelDetailTv = (TextView) findViewById(R.id.tv_level_detail);
        findViewById(R.id.ll_my_order).setOnClickListener(this);
        findViewById(R.id.ll_my_bill).setOnClickListener(this);
        findViewById(R.id.ll_my_schedule).setOnClickListener(this);
        findViewById(R.id.ll_setting).setOnClickListener(this);
        findViewById(R.id.ll_feedback).setOnClickListener(this);

        request = new DriverRequest(this, new WeakHandler(this));
        request.getInfo();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_my_order : {
                Intent intent = new Intent(this, OrdersActivity.class);
                startActivity(intent);
                break;
            }
            case R.id.ll_my_bill : {
                break;
            }
            case R.id.ll_my_schedule : {
                break;
            }
            case R.id.ll_setting : {
                Intent intent = new Intent(this, SettingActivity.class);
                startActivity(intent);
                break;
            }
            case R.id.ll_feedback : {
                Intent intent = new Intent(this, FeedbackActivity.class);
                startActivity(intent);
                break;
            }
        }
    }

    @Override
    protected void handleSuccessResult(int what, @NonNull ResultBean result) {
        switch (what) {
            case RequestModules.GETINFO : {
                // update Info
                result.getData();
//                ImageLoader.getInstance().displayImage();
                break;
            }
        }
    }
}
